<?php 
defined('RUN_KATANA') or die('Restricted access');
$zones = $shop->getShippingZones();
$setFavStore = 0;
if(intval($_REQUEST['fav_store']) > 0)
{ $setFavStore = intval($_GET['fav_store']); }
?>
<ul class="nav navbar-nav navbar-left">
  <li class="dropdown">
  	<?php 
	$out = '';
	if($zones)
	{
		$selected = '';
		foreach($zones as $zone)
		{
			if($zone['parent_id'] == 3)
			{
				if((isset($_COOKIE['fav_store'])) || ($setFavStore > 0))
				{
					if($setFavStore > 0)
					{
						if($setFavStore == $zone['id'])
						{ $selected = str_replace('Baker Hansen ', '', $zone['title']); }
					}
					else
					{
						if(intval($_COOKIE['fav_store']) == $zone['id'])
						{ $selected = str_replace('Baker Hansen ', '', $zone['title']); }
					}
					
				}
				$out .= '<li>';
				$out .= '<a href="?fav_store='.$zone['id'].'">';
				$out .= $zone['title'];
				$out .= '</a>';
				$out .= '</li>';
			}
		}
	}
	?>
    <a href="#" class="dropdown-toggle" data-toggle="dropdown">Din favoritt butikk&nbsp;:&nbsp;<?php echo $selected; ?> <b class="caret"></b></a>
    <ul class="dropdown-menu">
    	<?php echo $out; ?>
      	<li class="divider"></li>
    </ul>
  </li>
</ul>
<?php /* 
<form id="mod_fav_store" action="<?php echo $katana->getFormAction(); ?>" method="post" enctype="multipart/form-data" name="fav_store">
<table border="0" cellpadding="0" cellspacing="0">
	<tbody>
	<tr>
    	<td valign="middle">Din favoritt butikk&nbsp;:&nbsp;</td>
        <td valign="middle">
        <select id="fav_store" name="fav_store" style="width:240px;" onchange="submit();">
    	<option>Velg din favoritt butikk</option>
        <?php 
		if($zones)
		{
			foreach($zones as $zone)
			{
				$selected = '';
				if($zone['parent_id'] == 3)
				{
					if((isset($_COOKIE['fav_store'])) || ($setFavStore > 0))
					{
						if($setFavStore > 0)
						{
							if($setFavStore == $zone['id'])
							{ $selected = 'selected="selected"'; }
						}
						else
						{
							if(intval($_COOKIE['fav_store']) == $zone['id'])
							{ $selected = 'selected="selected"'; }
						}
						
					}
				?>
                <option value="<?php echo $zone['id'] ?>" <?php echo $selected; ?>><?php echo str_replace('Baker Hansen Bogstadveien', 'Bogstadveien', $zone['title']); ?></option>
                <?php 
				}
			}
		}
		?>
    </select>
        </td>
    </tr>
    </tbody>
</table>
</form> */?>